using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Preparation;

namespace Tester.GuiActions.Actions.Impl
{
    public class ShowAllAction : BaseAction
    {
        private MainMenuManager.MainMenuItem _item;

        public override void CustomActionForMenu(MainMenuManager.MainMenuItem item)
        {
            _item = item;
            item.MenuItem.CheckOnClick = true;
            if (TesterMultyDocument.Instance!=null)
            {
                item.MenuItem.Checked = TesterMultyDocument.Instance.ShowAllTests;
            }
        }

        public override bool Visible
        {
            get
            {
                return TesterMultyDocument.Instance!=null &&
                      TesterMainForm.Instance.TopControl == EmbededControlTags.TesterList;
            }
        }

        public override void MainAction(object sender, EventArgs e)
        {
            if (TesterMultyDocument.Instance!=null)
            {
                TesterMultyDocument.Instance.ShowAllTests = _item.MenuItem.Checked;
                TesterList.Instance.LoadList();
            }
        }
    }
}
